/* 
 * File:   Test.h
 * Author: user
 *
 * Created on July 31, 2014, 3:18 AM
 */

#ifndef TEST_H
#define	TEST_H

#include <stdio.h>
#include <iomanip>
#include <string>
#include "ExamTopic.h"

using namespace std;

class Test {
public:
    Test();
    Test(const Test& orig);
    virtual ~Test();
    
    bool extractExamTopic(string createBy);
    bool promptUserForSelectingExamTopic();
    
    bool extractQuestion();
    bool updateTestToDB(string takenBy,string examTopic, struct tm* dateTime);
    
    bool extractTestSummary(string takenBy);
    
    string getExamTopic();
    
private:
    ExamTopic _examTopic;
    int _timeOfAttempt;
    int _mark;
    
    void updateExamObject();
    bool executeSql(const char* sql,string table);
    
    static void processAnswer(string ans);
    static int querryCallBack_ExamTopic(void *data, int argc, char **argv, char **azColName);
    static int querryCallBack_Question(void *data, int argc, char **argv, char **azColName);
    static int querryCallBack_TestSummary(void *data, int argc, char **argv, char **azColName);
    
    bool validateIntInput(string input, int& output);

};

#endif	/* TEST_H */

